package com.lzy.websocket.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lzy.websocket.bean.Message;
import com.lzy.websocket.mapper.MessageMapper;
import com.lzy.websocket.service.MessageService;

@Service
public class MessageServiceImpl implements MessageService {

	@Autowired
	private MessageMapper messageMapper;
	
	@Override
	public List<Message> getMessagesByUserName(String userName1, String userName2) {
		return messageMapper.listMessages(userName1, userName2);
	}

	@Override
	public boolean insertMessage(Message message) {
		try {
			messageMapper.insertMessage(message);
		}catch(Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}

}
